import type { ButtonProps, DataTableRowData } from 'naive-ui'
import type { CSSProperties, Ref, VNodeChild, VNodeProps } from 'vue'

export type RowData = DataTableRowData

export type Size = 'small' | 'medium' | 'large'

export interface BaseComponentProps {
  style?: string | CSSProperties
  class?: string | (string | undefined)[] | Record<string, boolean>
}

export interface CustomSlots {
  [key: string]: (...args: any) => VNodeChild
}

export interface Constructor<P = any> {
  __isFragment?: never
  __isTeleport?: never
  __isSuspense?: never
  new (...args: any[]): {
    $props: P
  }
}
export type RawProps = VNodeProps & {
  __v_isVNode?: never
  [Symbol.iterator]?: never
} & RowData

export type DynamicProp<T> = T | Ref<T> | ((form: RowData) => T)

type Dict = NvOption[] | string
export type NvDict<Form = RowData> = Dict | Ref<Dict> | ((form: Form) => Dict | Promise<Dict>)

export interface NvBtnOption extends Omit<ButtonProps, 'renderIcon'>, BaseComponentProps {
  content?: boolean | string | (() => VNodeChild)
  visible?: boolean | Ref<boolean>
  renderIcon?: boolean | (() => VNodeChild)
}

export interface NvOption<T = string | number> {
  label: string
  value: T
  disabled?: boolean
  children?: NvOption<T>[]
  [key: string]: unknown
}
